SciChart WPF 3D Charts > ChartModifier3D API > Zooming and Panning > The Freelook Modiifer
The Freelook Modiifer

Zooming and Panning a Chart in SciChart3D is achieved by moving the SciChart3DSurface.Camera to a new location.

The article "The SciChart3DSurface Camera" goes into detail how this camera class works and how to manipulate it programatically to achieve various views.

If you want to add simple mvement of the camera (imagine free-look in a computer game) then you can do so using our ChartModifiers API. The FreelookModifier3D performs camera in the Forward/Backward/Left/Right/Up/Down direciton giving the appearance of moving through the 3D World

 

 

Usage of the FreelookModifier3D

The following controls manipulate the camera in Free-look mode.

  • Keyboard W: move the camera forward
  • Keyboard S: move the camera backward
  • Keyboard A: Strafe the camera sideways/left
  • Keyboard D: Strafe the camera sideways/right
  • Keyboard E: Move the camera directly upwards
  • Keyboard C: Move the camera directly downwards
  • Mouse move (with left button pressed): Rotate the camera left/right/up/down

This motion can sometimes be confusing for navigating a chart, and is more suitable for navigating a large 3D terrain or 3D object for instance. It can sometimes be used to

Declaring an FreelookModifier3D in XAML

Declaring an FreelookModifier3D is as simple as adding one to the SciChart3DSurface.ChartModifier property. This can be done as a single modifier, or as part of a ModifierGroup3D.

 

<s3D:SciChart3DSurface x:Name="scs" >
   
    <!-- XAxis, YAxis, RenderableSeries omitted for brevity -->       
   
    <s3D:SciChart3DSurface.ChartModifier>
        <s3D:ModifierGroup3D>
            <!-- Add the FreeLookModifier3D to the chart. Optional. add other modifiers -->
            <s3D:FreeLookModifier3D MovementSpeed="5" ForwardKey="W" BackKey="X"
                                    RightKey="D" LeftKey="A"
                                    UpKey="E" DownKey="C" 
                                    ExecuteOn="MouseLeftButton" IsEnabled="True"/>       
        </s3D:ModifierGroup3D>
    </s3D:SciChart3DSurface.ChartModifier>
   
</s3D:SciChart3DSurface>
var sciChart3DSurface = new SciChart3DSurface();
// XAxis, YAxis, RenderableSeries omitted for brevity
var modifierGroup = new ModifierGroup3D();
modifierGroup.ChildModifiers.Add(new FreeLookModifier3D () {
    IsEnabled = true, 
    MovementSpeed = 5f,
    ForwardKey = Keys.W,
    BackKey = Keys.X,
    LeftKey = Keys.A,
    RightKey = Keys.D,
    UpKey = Keys.E,
    DownKey = Keys.C,
});
sciChart3DSurface.ChartModifier = modifierGroup;